From a37a7e4c28a96e1f0fc2ff7bf649e466f18e7926 Mon Sep 17 00:00:00 2001 From: oliskoli Date: Tue, 1 Nov 2005 23:53:52 +0000 Subject: [PATCH] New script to generate a RPM compatible ChangeLog from changes.html --- tools/mkchangelog | 62 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 62 insertions(+) create mode 100755 tools/mkchangelog diff --git a/tools/mkchangelog b/tools/mkchangelog new file mode 100755 index 000000000..6f7c80b0e --- /dev/null +++ b/tools/mkchangelog @@ -0,0 +1,62 @@ +#!/bin/sh +# +# creates a RPM compatible ChangeLog file from babelweb/changes.html +# (published at http://www.gpsbabel.org) +# +# !!! requires changes.html in current directory !!! +# output results to stdout +# + +cat changes.html | +sed -e :a -e 's/<[^<]*>/ /g;//g' -e 's/</\ +BEGIN { line=0; item=0; OUTP="" } +/^20[0-9][0-9]-[0-9][0-9]-/ { # this will be work until 2099 + line++ + item=0 + if (length(OUTP) > 0) + { + printf("%s\n", OUTP) + OUTP="" + } + printf("%s", substr($0, 1, 10)) + next +} +{ if (line==0) next } # skip header stuff +{ + item++; + if (item==1) + { + if (length($0) > 0) OUTP=sprintf(" %s:", $0) + next + } + else if (length($0) > 0) + { + OUTP=sprintf("%s %s", OUTP, $0) + next + } +} +END { if (length(OUTP) > 0) printf("%s\n", OUTP) } +' | +sort -r | # keep sure, lines "YYYY-MM-DD ....." are sorted in descending order +uniq | # and remove duplicates +awk ' +BEGIN { TMx=0 } +{ + DT=sprintf("%s %s %s 00 00 00", substr($0, 1, 4), substr($0, 6, 2), substr($0, 9, 2)) + TM=mktime(DT) + if (TM != TMx) + { + TX=strftime("%a %b %d %Y", TM) + printf("* %s http://www.gpsbabel.org\n", TX) + TMx = TM + } + OUTP=substr($0, 11) + while (substr(OUTP, 1, 1) <= " " ) { OUTP=substr(OUTP, 2) } + printf("- %s \n", OUTP) + next +} +' -- 2.30.2